<?php
class Application_Form_Ecurie extends Zend_Form
{
	public function init()
	{
		$fournPneuDbTable = new Application_Model_DbTable_FournPneu();
		$resultSet = $fournPneuDbTable->fetchAll();
		$fournPneutab=array();
		foreach($resultSet as $row)
		{
			$fournPneutab[$row->FPNUM] = $row->FPNOM;
		}
		$paysDAO = new Application_Model_PaysDAO();
		$pays = $paysDAO->findAll();
		$paystab = array();
		foreach($pays as $p)
		{
			$paystab[$p->getPayNum()] = $p->getPayNom();
		}
		
		$this->setName('addEcurie');
		$this->setMethod('post');
		$this->addAttribs(array('class'=>'form'));
        
		$this->addElement(
            'hidden', 'ecunum', array(
        ));
		
		$this->addElement(
            'text', 'ecunom', array(
                'label' => 'Nom de l\'ecurie :',
                'required' => true,
                'filters'    => array('StringTrim')
            ));
 		
       	$this->addElement('select', 'paynum',
                          array('MultiOptions' => $paystab,
                                  'required' => true,
                                  'label' => 'Pays :')
                          );    
                    
        $this->addElement('select', 'fpnum',
                          array('MultiOptions' => $fournPneutab,
                                  'required' => true,
                                  'label' => 'Fournisseur de pneu :')
                          );
                          
        $this->addElement('text', 'ecunomdir', array(
            'label' => 'Nom du directeur :',
            'required' => true
            ));
            
        $this->addElement('text', 'ecuadrsiege', array(
            'label' => 'Adresse du siege :',
            'required' => true
            ));
            
        $this->addElement('text', 'ecuadresseimage', array(
            'label' => 'Adresse de l\'image :',
            'required' => true
            ));
 
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Valider'
            ));
	}
}